/**
 * Voice
 * <p/>
 * User: joakimd
 * Date: 2013-02-04
 * Time: 17:10
 */
package org.dru.test {
public class Voice {
    private var _sample: Sample;
    private var _position: int;

    public function Voice(sample: Sample) {
        _sample = sample;
    }

    public function get length(): int {
        return _sample.length;
    }

    public function get position(): int {
        return _position;
    }

    public function set position(value: int): void {
        _position = value;
    }

    public function copyTo(dleft: Vector.<Number>, dright: Vector.<Number>, offset: int, length: int): void {
        _sample.copyTo(_position, dleft, dright, offset, length);
        updatePosition(length);
    }

    public function addTo(dleft: Vector.<Number>, dright: Vector.<Number>, offset: int, length: int): void {
        _sample.addTo(_position, dleft, dright, offset, length);
        updatePosition(length);
    }

    private function updatePosition(length: int): void {
        _position += length;
    }
}
}
